CtrlK
BlogDocsLog inGet started
Tessl Logo

JavaScript Language Patterns

Modern JavaScript (ES2022+) patterns for clean, maintainable code.

Invalid
This skill can't be scored yet
Validation errors are blocking scoring. Review and fix them to unlock Quality, Impact and Security scores. See what needs fixing →
SKILL.md
Quality
Evals
Security

JavaScript Language Patterns

Priority: P0 (CRITICAL)

Modern JavaScript standards for clean, maintainable code.

Implementation Guidelines

  • Variables: const default. let if needed. No var.
  • Functions: Arrows for callbacks. Declarations for top-level.
  • Async: async/await + try/catch.
  • Objects: Destructuring, Spread ..., Optional Chain ?., Nullish ??.
  • Strings: Template literals ${}.
  • Arrays: map, filter, reduce. No loops.
  • Modules: ESM import/export. Export only what is necessary.
  • Classes: Use #private fields for true privacy.

Anti-Patterns

  • No var: Block scope only.
  • No ==: Strict ===.
  • No new Object(): Use literals {}.
  • No Callbacks: Promisify everything.
  • No Mutation: Immutability first.

Code

// Modern Syntax
const [x, ...rest] = items;
const name = user?.profile?.name ?? 'Guest';

// Async
async function getUser(id) {
  try {
    const res = await fetch(`/api/${id}`);
    return res.json();
  } catch (err) {
    console.error(err);
    throw err;
  }
}

// Class + Private
class Service {
  #key;
  constructor(k) {
    this.#key = k;
  }
}

Reference & Examples

For advanced patterns and functional programming: See references/REFERENCE.md.

Related Topics

best-practices | tooling

Repository
HoangNguyen0403/agent-skills-standard
Last updated
Created

Is this your skill?

If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.